//
//  LoginRequestAccessory.m
//  SulitLoan
//
//  Created by 虞嘉伟 on 2025/3/2.
//

#import "LoginRequestAccessory.h"
#import "BasicRequest.h"


@implementation LoginRequestAccessory


- (void)requestWillStart:(id)request {
    
}
- (void)requestWillStop:(id)request {
    
}
- (void)requestDidStop:(id)request {
    if ([request isKindOfClass:BasicRequest.class]) {
        BasicRequest *req = (BasicRequest *)request;
        NSDictionary *dict = req.responseObject;
        if ([dict[@"weeps"] intValue] == -2) {
            
            Class User = NSClassFromString(@"User");
            NSObject *user = [User performSelector:@selector(user)];
            [user performSelector:@selector(setPhone:) withObject:nil];
            [user performSelector:@selector(setToken:) withObject:nil];
            [user performSelector:@selector(synchronize)];
            
            Class SLRoutePush = NSClassFromString(@"SLRoutePush");
            if (SLRoutePush && [SLRoutePush respondsToSelector:@selector(routeLoginController:)]) {
                [SLRoutePush performSelector:@selector(routeLoginController:) withObject:nil];
            }
//            [SLRoutePush routeLoginController:^(BOOL success) {
//                //登录成功
//            }];
        }
    }
}
@end
